<%--
 *  File:    ProdCompetitiveSummary.jsp
 *  @Author: KevinFan
 *  Date:    2012/09/28
 *
 *  Copyright (C) 2000 - 2012 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>

<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<%
  Category cat = Category.getInstance("jsp.ProdCompetitiveSummary");
  String privilegeCode = "10300";
  String strTableName = "ovproduct";
  String strModuleName = "PCM";
  String contextPath = request.getContextPath();
%>
<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/FrmDefault.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>

<html>
<head>
<title>ProdCompetitiveSummary</title>
<PageFlow:CheckPageFlow pageName="p_prodcptsummary"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath %>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath %>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/FuncLib.js"></script>

<%@ include file="/phap/inc/ExportURL.inc"%>
<%@ include file="/inc/SummaryDivision.inc" %>
<%
	Vector totalsummary = (Vector)pageContext.getAttribute("totalsummary");
	if(totalsummary == null) totalsummary = new Vector();
%> 
<script>
parent.down.location.href = "<%= contextPath%>/Blank.jsp?<%= OvalTools.randomURL() %>";
function clickProd(id)
{
  document.cform.prodcptid.value = id;
}
 
function page_delete()
{
  var id = document.cform.prodcptid.value;
  if(id == null || id.length == 0 || id == "" || id == "-1")
    return;
  var flag = confirm('<%=message.getMessageDesc("ARE_YOU_SURE_DEL")%>');
  if(!flag)
    return;
  document.cform.actionname.value = "delete";
  document.cform.target = "_self";
  isRunning = true;
  document.cform.submit();
}

function page_edit()
{
  var id = document.cform.prodcptid.value;
  if(id == null || id.length == 0 || id == "" || id == "-1")
    return;
  var link = "ProdCptEdit.jsp?<%= OvalTools.randomURL() %>&prodcptid=" + id;
  parent.down.location.href = link;
}

function page_new()
{
  var link = "ProdCptEdit.jsp?<%= OvalTools.randomURL() %>&isnew=Y";
  parent.down.location.href = link;
}

function page_info(prodcptid)
{
  var link = "ProdCptInfo.jsp?<%= OvalTools.randomURL() %>&prodcptid=" + prodcptid;
  parent.down.location.href = link;
}

function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(cform,actionvalue,orderbyname);
  editform.action = "ProdCompetitiveSummary.jsp?<%= OvalTools.randomURL() %>";  
  editform.target = "_self";
  isRunning = true;
  editform.submit();
}

</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<%@ include file="/inc/PageLocation.inc" %>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<form name="cform" method="post" action="../../../Dispatcher" target="_self">
      <input type="hidden" name="pagename" value="p_prodcptsummary">
      <input type="hidden" name="actionname">
  <tr>
    <td>
      <table width="100%" border="0" cellspacing="0">
        <tr>
          <td class="summary_top" colspan="2" ></td>
        </tr>
		<%@ include file="/inc/SummarySearch.inc" %> 
      </table>
    </td>
  </tr>
  <tr>
    <td>
      <table border="1" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellpadding="0" width="100%">
        <tr class="deepblue-left">
          <td width="1%" class="title_center">&nbsp;</td>
          <td class="title_center"><%= label.getLabelName("L_ProdCtpCode") %></td>          
          <td class="title_center"><%= label.getLabelName("L_ProdCtpName") %></td>
          <td class="title_center"><%= label.getLabelName("L_Unit") %></td>
        </tr>

          <%
            int i = 0;
            String strClassType = new String("");
            Integer nDefaultProdId = new Integer(-1);
            boolean bHasChecked = false;
            int nDefaultIndex=0;
          %>
          <logic:iterate id="onehash" collection="<%= totalsummary %>">
          <%
            HashMap maps = (HashMap)pageContext.getAttribute("onehash");
            String strIsChecked = new String("");
            if(i%2 == 1)
            {
              strClassType = "td-listrom";
            }else{
              strClassType = "none";
            }
            if(!bHasChecked)
            {
              strIsChecked = "Checked";
              bHasChecked = true;
              nDefaultProdId = (Integer)(maps.get("prodcptid"));
            }
            i++;

           %>
          <tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=strClassType%>'"  onClick="javascript:radiotrue('radio<%=i%>');clickProd('<%=JspHelper.filterNull( maps.get("prodcptid") )%>');" class="<%=strClassType%>">
            <td height="22">
              <input id="radio<%=i%>" type="radio" <%=strIsChecked%> name="checkprod" onClick="javascript:clickProd('<%=JspHelper.filterNull( maps.get("prodcptid") )%>')" class="normalradio">
            </td>
            <td><a href="javascript:page_info('<%=JspHelper.filterNull( maps.get("prodcptid") )%>');"><custom:write property="prodcptcode" name="onehash" nbsp="true"/></a></td>            
            <td><custom:write property="prodcptname" name="onehash" nbsp="true"/></td>
            <td><custom:write property="umname" name="onehash" nbsp="true"/></td>
          </tr>
          </logic:iterate>
          <input type="hidden" name="prodcptid" value="<%=JspHelper.filterNull( nDefaultProdId )%>">
         <%@ include file="/inc/SummaryAction.inc" %>
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td class="summary_top" ></td>
        </tr>
        <tr>
          <td class="td_center">
          <a onclick="page_new();"><custom:button type="1" label="L_New" imgsrc="new.gif" border="0" style="width:60"/></a>
          <a onclick="page_edit()"><custom:button type="1" label="L_Edit" imgsrc="edit.gif" border="0" style="width:60"/></a>
          <a onclick="page_delete()"><custom:button type="1" label="L_Delete" imgsrc="delete.gif" border="0" style="width:60"/></a>
          </td>
        </tr>
      </table>
    </td>
  </tr>

</table>
 </form>
</body>
</html>


